﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class shield : Skill
{
    public GameObject player;
    public override void Active(GameObject go)
    {
       
        if (go.tag == "Player")
        {
            once = true;
            go.transform.GetComponent<Player>().def += 0.5f;
            int shield_lvl = (int)(Player.Insatance.def / 0.5f);
            var main = player.transform.Find("shield").GetComponent<ParticleSystem>().main;
            Color color = new Color(1, 1, 1, shield_lvl / 5f);
            main.startColor = new ParticleSystem.MinMaxGradient(color);

        }
        else if (go.tag == "Enemy")
        {
            
            go.transform.GetComponent<Enemy>().def += 0.5f;
            int shield_lvl = (int)(Player.Insatance.def / 0.5f);
            var main = go.transform.Find("shield1").GetComponent<ParticleSystem>().main;
            Color color = new Color(1, 1, 1, shield_lvl / 5f);
            main.startColor = new ParticleSystem.MinMaxGradient(color);

        }
        //base.Active();
    }
}
